package com.shenyue.nbtownlet.model;

import android.content.Context;

import com.shenyue.nbtownlet.util.StorageUtil;
import com.shenyue.nbtownlet.util.StringUtil;

public class AppModel {
    /**
     * 工作流地址
     */
    //public final static String kLTRootFlowURL = "http://115.238.132.44:81/roadapi";//生产
    //public final static String kLTRootFlowURL = "http://183.136.157.18:7020/roadapi";//测试
    public final static String kLTRootFlowURL = DefaultModel.DEBUG
            ? "http://183.136.157.18:7020/roadapi"
            : "http://115.238.132.44:81/roadapi";
    /**
     * 服务地址
     */
    //public final static String kBaseURL = "http://115.238.132.44:81/yczjapi";//生产
    //public final static String kBaseURL = "http://183.136.157.18:7020/yczjapi";//测试
    public final static String kBaseURL = DefaultModel.DEBUG
            ? "http://183.136.157.18:7020/yczjapi"
            : "http://115.238.132.44:81/yczjapi";

    /**
     * 任务列表中获取来的传入的flow流程相关信息的键值对
     */
    public final static String FLOWID = "9b5503d8-e0bc-4d23-939c-e5fea3cbc4b3";
    /**
     * 任务列表中获取来的传入的flow流程相关信息的键值对
     */
    public final static String FORMID = "2";

    public final static String GROUPID = "36";

    /**
     * 收藏状态 已收藏
     */
    public final static String COLLECTED = "2";
    /**
     * 收藏状态 未收藏
     */
    public final static String UN_COLLECTED = "1";

    private final static String AREA_ID = "$area_id$";
    private final static String STREET_ID = "$street_id$";
    private final static String NINGBOAREA_ID = "$ningboarea_id$";

    public static final String APPKEY = "32E0778D38E68064D71FA435216EE643";
    public static final String SECRETKEY = "F327D2AFB8E9ECE1CBF8C4CD2033C517";


    public static String getNingBoAreaID(Context context) {
        String data = StorageUtil.getLocalStorage(context, NINGBOAREA_ID);
        return StringUtil.getValue(data);
    }

    public static void setNingBoAreaID(Context context, String areaId) {
        StorageUtil.setLocalStorage(context, NINGBOAREA_ID, areaId);
    }

    public static String getAreaId(Context context) {
        String data = StorageUtil.getLocalStorage(context, AREA_ID);
        if (StringUtil.isNull(data))
            return AppLoginModel.getAreaId(context);
        return StringUtil.getValue(data);
    }

    public static void setAreaId(Context context, String areaId) {
        StorageUtil.setLocalStorage(context, AREA_ID, areaId);
    }

    public static String getStreetId(Context context) {
        String data = StorageUtil.getLocalStorage(context, STREET_ID);
        if (StringUtil.isNull(data))
            return getAreaId(context);
        return StringUtil.getValue(data);
    }

    public static void setStreetId(Context context, String streetId) {
        StorageUtil.setLocalStorage(context, STREET_ID, streetId);
    }
}
